namespace Vanilla.UI

import System
import System.Runtime.InteropServices


// CANVAS
class Canvas (System.IDisposable):
	public Handle as IntPtr
	Disposed = false
	
	def constructor (h as IntPtr):
		Handle = h
	
	def WriteToPNG (filename as string):
		Cairo.SurfaceWriteToPNG(Handle, filename)
	
	def Dispose ():
		Disposed = true
		Cairo.SurfaceDestroy(Handle)
	
	def destructor ():
		Dispose() unless Disposed
